<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js"></script> </head>

<body>
    <nav id="navbar-example2" class="navbar navbar-light bg-light">
        <a class="navbar-brand" href="#">Navbar</a>
        <ul class="nav nav-pills">
            <li class="nav-item">
                <a class="nav-link" href="#fat">@fat</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#mdo">@mdo</a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#"
                    role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="#one">one</a>
                    <a class="dropdown-item" href="#two">two</a>
                    <div role="separator" class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#three">three</a>
                </div>
            </li>
        </ul>
    </nav>
    <div data-spy="scroll" style="position: relative; overflow-y:scroll; 
        height:300px" data-target="#navbar-example2" data-offset="0">
        <h4 id="fat">@fat</h4>
        <p>Ad leggings keytar, brunch id art party dolor labore. </p>
        <h4 id="mdo">@mdo</h4>
        <p><br/><br/><br/><br/><br/><br/><br/><br/><br/></p>
        <h4 id="one">one</h4>
        <p><br/><br/><br/><br/><br/><br/><br/><br/><br/></p>
        <h4 id="two">two</h4>
        <p><br/><br/><br/><br/><br/><br/><br/><br/><br/></p>
        <h4 id="three">three</h4>
        <p><br/><br/><br/><br/><br/><br/><br/><br/><br/></p>
    </div>
</body>

</html>